home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 January / 1995-01b.d64 / disk checker (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  198 lines

  1. 0 rem
  2. 90 print"[147][152]":poke53280,2:poke53281,15
  3. 92 print"            disk checker
  4. 93 [153]"  gives disk a good check for -           start links
  5. 94 print"  compares file length to dir file        length
  6. 95 [153]"  files overlapping                       actual blocks free
  7. 96 print"  put disk to be checked in drive         press <space> to check[152]
  8. 97 [161]g$:[139]g$[179][177]" "[167]97
  9. 100 [137]280
  10. 110 [143] inner trace loop
  11. 120 [152]1,"u1 2 0";t;s
  12. 130 [132]1,en,em$,et,es
  13. 140 [139]en[179][177]0[167]1960:[143] disk trace error
  14. 150 lt%(i)[178]lt%(i)[170]1
  15. 160 [139]ob%(t,s)[179][177]0[167]1410:[143] file intersect
  16. 170 ob%(t,s)[178]i
  17. 180 [161]#2,a$,b$
  18. 190 [139]a$[178]""[167]1450:[143] trace loop continue
  19. 200 [139]b$[178]""[167]b$[178][199](0)
  20. 210 t[178][198](a$):s[178][198](b$)
  21. 220 [137]120:[143] inner trace loop
  22. 230 [143]*******************************
  23. 240 [143]disk checker
  24. 250 [143]
  25. 260 [143]don fulton
  26. 270 [143]*******************************
  27. 280 [134]i,s,t,x,y,z
  28. 290 [134]bc,en,es,et,im,lc,of,pf,s1,s2,sf,t1,t2
  29. 300 [134]ts%(144),ss%(144),ld%(144),lt%(144),pf%(144),n$(144)
  30. 310 [134]ob%(35,20)
  31. 320 [160]1:[159]1,8,15:[160]2:[160]1
  32. 330 [143]-------------------------------
  33. 340 [153]"load"
  34. 350 [153]
  35. 360 [153]"            disk checker
  36. 370 print"           [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]
  37. 380 [153]" checks:
  38. 390 print
  39. 400 print"  -- start links different
  40. 410 [153]
  41. 420 [153]"  -- trace file len = dir file len
  42. 430 print
  43. 440 print"  -- files do not overlap
  44. 450 [153]
  45. 460 [153]"  -- blocks free
  46. 470 print
  47. 550 print" [207][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][208]
  48. 560 [153]" fnthis utility does not write to disk.then
  49. 570 print" [165]                                    [167]
  50. 580 [153]" fn   (problem files are displayed)wait    then
  51. 590 print" [165]          in inverse video)[146]         [167]
  52. 600 [153]" (NULL)andandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandsqr
  53. 610 forx=1to1000:next
  54. 620 print
  55. 630 rem-------------------------------
  56. 640 rem find start of active files
  57. 650 print
  58. 660 print"      start                    length  "
  59. 670 print"file  t , s    file name     dir--trace"
  60. 680 print"[163][163][163][163]  [163][163][163][163][163]   [163][163][163][163][163][163][163][163][163][163][163]    [163][163][163]  [163][163][163][163][163]"
  61. 690 open1,8,15
  62. 700 open2,8,2,"#"
  63. 710 t1=18:s1=1:i=1
  64. 720 rem next directory sector
  65. 730 :ift1=0then1010:rem directory close
  66. 740 :print#1,"u1 2 0";t1;s1
  67. 750 :input#1,en,em$,et,es
  68. 760 :ifen<>0then1980:rem disk error
  69. 770 :get#2,a$,b$
  70. 780 :t2=t1:s2=s1
  71. 790 :t1=asc(a$+chr$(0))
  72. 800 :s1=asc(b$+chr$(0))
  73. 810 :forx=2to255step32
  74. 820 :print#1,"u1 2 0";t2;s2
  75. 830 :print#1,"b-p 2";x
  76. 840 :input#1,en,em$,et,es
  77. 850 :ifen<>0then1980:rem disk error
  78. 860 :get#2,c$,d$,e$,f$,g$,h$,i$,j$,k$,l$,m$,n$,o$,p$,q$,r$,s$,t$,u$
  79. 870 :ifc$=""then980:rem directory continue
  80. 880 :ts%(i)=asc(d$+chr$(0))
  81. 890 :ss%(i)=asc(e$+chr$(0))
  82. 900 :n$(i)=f$+g$+h$+i$+j$+k$+l$+m$+n$+o$+p$+q$+r$+s$+t$+u$
  83. 910 :print#1,"b-p 2";x+28
  84. 920 :get#2,v$,w$
  85. 930 :ld%(i)=asc(v$+chr$(0))+256*asc(w$+chr$(0))
  86. 940 :printi;tab(4)ts%(i);tab(8)",";tab(9)ss%(i);
  87. 950 :printtab(13)n$(i);tab(29)ld%(i);tab(33);"--";lt%(i)
  88. 960 :i=i+1
  89. 970 :rem directory continue
  90. 980 :next
  91. 990 goto730:rem next directory sector
  92. 1000 rem directory close
  93. 1010 im=i-1
  94. 1020 close2:close1
  95. 1030 rem------------------------------
  96. 1040 print
  97. 1050 print" checking start links for overlap"
  98. 1060 print
  99. 1070 ifim=0orim=1then1250:rem start]link end
  100. 1080 fori=2toim
  101. 1090 :fory=1toi-1
  102. 1100 :ifts%(y)=ts%(i)thenifss%(y)=ss%(i)then1150:rem file overlap
  103. 1110 :next
  104. 1120 next
  105. 1130 goto1250:rem start linkend
  106. 1140 rem file overlap
  107. 1150 :pf%(i)=1:pf%(y)=1
  108. 1160 :of=1:rem set]overlap flag
  109. 1170 :printy;chr$(18);tab(4)ts%(y);tab(8)",";
  110. 1180 :printtab(9)ss%(y);tab(13)n$(y);chr$(146);
  111. 1190 :printtab(29)ld%(y);tab(33);"--";lt%(y)
  112. 1200 :printi;chr$(18);tab(4)ts%(i);tab(8)",";
  113. 1210 :printtab(9)ss%(i);tab(13)n$(i);chr$(146);
  114. 1220 :printtab(29)ld%(i);tab(33);"--";lt%(i)
  115. 1230 goto1110:rem start link continue
  116. 1240 rem start link end
  117. 1250 ifof=0thenprint"     --start links ok--"
  118. 1260 rem-----------------------------
  119. 1270 print
  120. 1280 print" tracing files"
  121. 1290 print
  122. 1300 open1,8,15
  123. 1310 open2,8,2,"#"
  124. 1320 ifim=0then1530:rem trace end
  125. 1330 fori=1toim
  126. 1340 :t=ts%(i)
  127. 1350 :s=ss%(i)
  128. 1360 :lt%(i)=0
  129. 1370 :pf$=""
  130. 1380 :sf=0
  131. 1390 :goto120:rem inner trace loop
  132. 1400 :remfileintersect
  133. 1410 :pf%(ob%(t,s))=1
  134. 1420 :pf%(i)=1
  135. 1430 :sf=1:rem set intersect flag
  136. 1440 :rem trace loop continue
  137. 1450 :bc=bc+lt%(i)
  138. 1460 :printi;tab(4)ts%(i);tab(8)",";tab(9)ss%(i);
  139. 1470 :iflt%(i)<>ld%(i)thenpf%(i)=pf%(i)+2:print"[150]";:gosub2060
  140. 1480 :printtab(13)n$(i);tab(29)"[152]"ld%(i);tab(33);"--";lt%(i):gosub2050
  141. 1490 :ifpf$<>""thenprint"   (file";i;"contains ";+pf$;")":print
  142. 1500 :ifsf=1thenprint"   (file";i;"intersects file ";ob%(t,s);")":print
  143. 1510 next
  144. 1520 rem trace end
  145. 1530 close2:close1
  146. 1540 rem------------------------------
  147. 1550 print
  148. 1560 print" problem files--"
  149. 1570 print" [163][163][163][163][163][163][163][163][163][163][163][163][163]"
  150. 1580 ifim=0then1710:rem problem file end
  151. 1590 fori=1toim
  152. 1600 :ifpf%(i)=0then1690:rem problem loop continue
  153. 1610 :pf=1:rem set problem file flag
  154. 1620 :printi;
  155. 1630 :ifpf%(i)=1orpf%(i)=3thenprintchr$(18);
  156. 1640 :printtab(4)ts%(i);tab(8)",";tab(9)ss%(i);
  157. 1650 :printchr$(18);tab(13)n$(i);chr$(146);
  158. 1660 :ifpf%(i)=2orpf%(i)=3thenprintchr$(18);
  159. 1670 :printtab(29)ld%(i);tab(33);"--";lt%(i)
  160. 1680 :rem problem loop continue
  161. 1690 next
  162. 1700 rem problem file end
  163. 1710 ifpf=0thenprint"      none"
  164. 1720 print
  165. 1730 print" block count = ";bc
  166. 1740 print
  167. 1750 print" blocks free = ";664-bc;tab(20)"(trace)"
  168. 1760 fori=0toim
  169. 1770 :lc=lc+ld%(i)
  170. 1780 next
  171. 1790 print" blocks free = ";664-lc;tab(20)"(dir)"
  172. 1800 rem------------------------------
  173. 1810 rem dir bam blocks free
  174. 1820 open1,8,15
  175. 1830 open2,8,2,"#"
  176. 1840 print#1,"u1 2 0";18;0
  177. 1850 input#1,en,em$,et,es
  178. 1860 ifen<>0then1980:rem disk error
  179. 1870 forx=0to35
  180. 1880 :get#2,w$,x$,y$,z$
  181. 1890 :ifx<>0andx<>18thenbu=bu+asc(w$+chr$(0))
  182. 1900 next
  183. 1910 print" blocks free = ";bu;tab(20)"(bam)"
  184. 1920 close2:close1
  185. 1930 end
  186. 1940 rem------------------------------
  187. 1950 rem disk trace error
  188. 1960 ifen=66thenpf$="illegal link":goto1450:rem trace loop continue
  189. 1970 rem disk error
  190. 1980 print
  191. 1990 print" unrecoverable disk error"
  192. 2000 print
  193. 2010 printen;em$;et;es
  194. 2020 close2:close1
  195. 2030 end
  196. 2050 fortu=20to0step-.9:poke54296,tu:poke54296,0:next:return
  197. 2060 fortu=78to0step-.9:poke54296,tu:poke54296,0:next:return
  198.